home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_lavaguy.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  134 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_LavaGuy.cog
  4. #
  5. # [RT] [MDR]
  6. #
  7. # Animates little Lava Guy's texture and other exciting stuff.
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message        initialized
  16.     message        aievent
  17.     message        damaged
  18.     message        timer
  19.     message        pulse
  20.  
  21. # ************************** TEMPLATES *************************
  22.     template    tpl_ghost=ghost                    local
  23.     template    tpl_sparks=+imp2_trail            local        # Lava guy shot sparks
  24.     material    flame=flame4_01.mat                local
  25.  
  26.     flex        fps=8.0                            local
  27.  
  28. # ************************** MISC LOCAL VARS *******************
  29.     thing        t_sender                        local
  30.     thing        t_obj                            local
  31.     int            n_animID=-1                        local
  32.     int            n_srfFlags                        local
  33.     int            damageType                        local
  34.  
  35. end
  36.  
  37. # ========================================================================================
  38.  
  39. code
  40.  
  41. # ...................................................................
  42. initialized:
  43.  
  44.     t_sender = GetSenderRef();
  45.  
  46.     if ( n_animID == -1 )
  47.     {
  48.         n_animID = MaterialAnim(flame, fps, 1);
  49.     }
  50.     AISetAllowedSurfaceType(t_sender, 0x200001);            # Allow SURFACE_(LAVA|ISFLOOR) stepping
  51.     PlaySoundClass(t_sender, 123);                            # play 'reserved1'
  52.  
  53.     t_obj = CreateThing(tpl_ghost, t_sender);                # Create a GHOST for as a VFX "timer"
  54.     if ( t_obj > -1 )
  55.     {
  56.         CaptureThing(t_obj);
  57.         SetThingPulse(t_obj, 0.02);
  58.         SetLifeLeft(t_obj, 1.5);
  59.         AttachThingToThingEx(t_obj, t_sender, 0x08);
  60.     }
  61.  
  62.     return;
  63.  
  64. # ...................................................................
  65. aievent:
  66.  
  67.     t_sender = GetSenderRef();
  68.  
  69.     if ( GetParam(0) == 0x4000 )                                #---- EVENT_FIRE
  70.     {    
  71.         # Firing on something... blow up reeeal good!
  72.         DamageThing(t_sender, GetThingHealth(t_sender), 1, t_sender);
  73.     }
  74.     else if ( GetParam(0) == 0x200000 )                            #---- EVENT_LANDFLOOR
  75.     {                                                            # Param(2) == surface index
  76.         n_srfFlags = GetSurfaceFlags(GetParam(2));
  77.  
  78.         if ( n_srfFlags > -1 && BITTEST(n_srfFlags, 0x200000) )        # Landed on lava?
  79.         {
  80. #            DEBUGPRINT("Lava guy landed on lava");
  81.  
  82.             SetThingUserData(t_sender, 1);                            # Mark him as 'absorbed by lava'
  83.  
  84.             StopThing(t_sender);                                    # Stop him
  85.             AISetMode(t_sender, 0x2000);                            # Disable him
  86.             ThingFadeAnim(t_sender, 1, 0, 2, 0);                    # Fade him
  87.             SetThingTimer(t_sender, 2);                                # Destroy him in a few sec
  88.             PlaySoundClass(t_sender, 123);                            # play 'reserved1'
  89.         }
  90.     }
  91.  
  92.     return;
  93.  
  94. # ...................................................................
  95. damaged:
  96.  
  97.     damageType = GetParam(1);
  98.     
  99.     # RT: Don't pay attention to chicken damage....
  100.     if ( BITTEST(damageType, 0x80000000) )
  101.     {
  102.         ReturnEx(0);
  103.     }
  104.  
  105.     return;
  106.  
  107.  
  108. # ...................................................................
  109. timer:
  110.  
  111.     t_sender = GetSenderRef();
  112.     if ( GetThingUserData(t_sender) == 1 )
  113.     {
  114.         # NOTE: SetLifeLeft wont work, want AI to disappear even when seen
  115.         DestroyThing(t_sender);
  116.     }
  117.  
  118.     return;
  119.  
  120.  
  121. # ...................................................................
  122. pulse:
  123.  
  124.     t_sender = GetSenderRef();
  125.     if ( GetThingType(t_sender) == 8 )                                # SITH_THING_GHOST?
  126.     {
  127.         CreateThingAtPos(tpl_sparks, GetThingSector(t_sender), GetThingPos(t_sender), '0 0 0');
  128.     }
  129.     return;
  130.  
  131.  
  132. end
  133.  
  134.